#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct TreeNode
{
	char data;
	struct TreeNode* left;
	struct TreeNode* right;
}TreeNode;
TreeNode* buildTree(char* preorder, int* index)
{
	if (preorder[*index] == '#')
	{
		(*index)++;
		return NULL;
	}
	if (preorder[*index] == '\0')
	{
		return NULL;
	}
	TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));
	root->data = preorder[*index];
	(*index)++;
	root->left = buildTree(preorder, index);
	root->right = buildTree(preorder, index);
	return root;
}
void postorderTraversal(TreeNode* root)
{
	if (root == NULL)
	{
		return;
	}
	postorderTraversal(root->left);
	printf("%c", root->data);
	postorderTraversal(root->right);
}
int main()
{
	char preorder[2000];
	scanf("%s", preorder);
	int index = 0;
	TreeNode* root = buildTree(preorder, &index);
	postorderTraversal(root);
	return 0;

}